package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.ShareProfitRatio;
import com.sc.nft.enums.AllocationTypeEnum;
import com.sc.nft.mapper.ShareProfitRatioMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_share_profit_ratio)数据DAO
 *
 * @author zxy
 * @since 2023-12-06 16:05:42
 * @description 商户banner
 */
@Slf4j
@Repository
public class ShareProfitRatioDao extends ServiceImpl<ShareProfitRatioMapper, ShareProfitRatio> {


    public void clearByPanelId(Long panelId) {
        lambdaUpdate().eq(ShareProfitRatio::getPanelId, panelId).remove();
    }

    public List<ShareProfitRatio> getProfitId(Long profitId) {
        return lambdaQuery().eq(ShareProfitRatio::getProfitId, profitId).list();
    }

    public List<ShareProfitRatio> getProfitIdAndType(Long profitId, AllocationTypeEnum allocationType) {
        return lambdaQuery().eq(ShareProfitRatio::getProfitId, profitId).eq(ShareProfitRatio::getAllocationPoolType, allocationType).list();
    }
}